package com.example.goodpet.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.google.gson.annotations.SerializedName;

public class BannerInfoDTO implements Parcelable {

    @SerializedName("image")
    private String image;
    @SerializedName("id")
    private Integer id;

    protected BannerInfoDTO(Parcel in) {
        image = in.readString();
        if (in.readByte() == 0) {
            id = null;
        } else {
            id = in.readInt();
        }
    }

    public static final Creator<BannerInfoDTO> CREATOR = new Creator<BannerInfoDTO>() {
        @Override
        public BannerInfoDTO createFromParcel(Parcel in) {
            return new BannerInfoDTO(in);
        }

        @Override
        public BannerInfoDTO[] newArray(int size) {
            return new BannerInfoDTO[size];
        }
    };

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    @Override
    public String toString() {
        return "BannerInfoDTO{" +
                "image='" + image + '\'' +
                ", id=" + id +
                '}';
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(image);
        if (id == null) {
            dest.writeByte((byte) 0);
        } else {
            dest.writeByte((byte) 1);
            dest.writeInt(id);
        }
    }
}
